import React from 'react';
import MyBreadcrumb from '@/components/MyBreadcrumb'
import { useMount } from 'ahooks';
import { connect } from 'umi'
import { Table } from 'antd'
type ProListProps = {

};

const index:React.FC<ProListProps> = (props) => {
  console.log('555', props)
  useMount(() => {
    props.dispatch({
      type: 'pro/getProListEffect',
      payload: {}
    })
  })
  const columns = [
    {
      title: '序号',
      render (text, record, index) {
        return (
          <text>{ index + 1} </text>
        )
      }
    },
    {
      title: '产品名称',
      dataIndex: 'proname'
    },
    {
      title: '产品价格',
      dataIndex: 'originprice'
    },
  ]
  return (
    <>
      <MyBreadcrumb />
      <div>
        <Table columns = { columns } dataSource = { props.proList }/>
      </div>
    </>
  )
}
export default connect(state => {
  console.log('222', state)
  return {
    proList: state.pro.proList
  }
})(index);
